package com.lwc.controller;

import com.lwc.bean.Order;
import com.lwc.service.GoodsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@Slf4j
public class OrderController {

@Autowired
GoodsService goodsService;



    @PostMapping ("/save")
    public  String save(@RequestBody Order order){
    //生成订单
        try {
            Thread.sleep(3110);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        log.info("生成订单"+order.toString());
        //更新库存
       String tmp=goodsService.update(order.getOrderDetails());


        return "ok";
    }


}
